home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / switcher / toasterserialhost.rexx < prev    next >
OS/2 REXX Batch file  |  1993-12-13  |  1KB  |  39 lines

  1. /* ToasterSerialHost.rexx -- Provide serial access to Switcher() functions */
  2. /* This script replaces that abomination 'remote.rexx' and provides an alternative
  3.  * to the ToastNSerial program which also lets you send ARexx commands to the
  4.  * Toaster via serial port.
  5.  * By Arnie Cachelin  © 1992 NewTek Inc. */
  6.  
  7. OPTIONS RESULTS
  8.  
  9. HOST_EXIT='EXIT'       /* Send this string to shut down this program */
  10. TOASTERLIB="ToasterARexx.port"    /* Name of the Toaster function host port */
  11. res=""
  12.  
  13. IF ~SHOW('Libraries',TOASTERLIB) THEN
  14.   IF ~ADDLIB(TOASTERLIB , 0) THEN x=Bummer(" Please start your Video Toaster!")
  15.  
  16. IF OPEN(SerialPort,"AUX:",'A') THEN
  17.   DO FOREVER
  18.     pktstring = READLN(SerialPort)
  19.     IF UPPER(pktstring) =HOST_EXIT THEN x=Bummer(" Received "EXIT" request.")
  20.     pktstring=TRANSLATE(STRIP(pktstring),","," ")  /* replace space with comma */
  21.     FunctionCmd="res=Switcher("pktstring")"
  22.     INTERPRET FunctionCmd
  23.     IF res="SWITCHER" THEN
  24.       Writeln(SerialPort,"OK")
  25.     ELSE
  26.       Writeln(SerialPort,res)
  27.     END
  28.     res=""
  29.   END
  30. ELSE SAY "Can't open serial port"
  31. EXIT
  32.  
  33. Bummer: PROCEDURE
  34.  ARG etxt
  35.  SAY "ERROR: "||RC||etxt
  36.  close(SerialPort)
  37.  EXIT
  38.  RETURN 0
  39.